package cn.cstech.aijia.sns;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;

import cn.cstech.aijia.sns.lsn.OnSnsResponseListener;
import cn.cstech.aijia.sns.sms.SMSController;
import cn.cstech.aijia.sns.weixin.WeiXinController;

public class SNSController {
	private Context mContext;
	private Activity mActivity;
	private static SNSController Instance;
	
	public SNSController(Activity activity) {
		mContext = activity;
		mActivity = activity;
	}
	
	public void initAll(){
		WeiXinController.getInstance(mActivity).init();
//		QQController.getInstance(mContext, mActivity).init();
//		WeiBoController.getInstance(mContext,mActivity).init();
	}
	
	public static SNSController getInstance(Activity activity){
		if(Instance == null){
			Instance = new SNSController(activity);
		}
		
		return Instance;
	}
	
	public void sendText(String title,
			String content,
			String pic_url,
			String pic_path,
			String webUrl,
			Bitmap thumb,
			SHARE_MEDIA where ,
			OnSnsResponseListener lsn){
		if(where == SHARE_MEDIA.WEIXIN){
			WeiXinController.getInstance(mActivity).sendTextMessage(title, 
					content, 
					pic_path,
					pic_url,
					webUrl,
					thumb,
					false , 
					lsn);
		}else if(where == SHARE_MEDIA.WEIXIN_CIRCLE){
			WeiXinController.getInstance(mActivity).sendTextMessage(title,
					content,
					pic_path,
					pic_url,
					webUrl,
					thumb,
					true , 
					lsn);
		}else if(where == SHARE_MEDIA.QQ){
//			QQController.getInstance(mContext, mActivity).sendMessage(
//					title, 
//					webUrl,
//					content, 
//					pic_url,
//					pic_path, 
//					null,
//					lsn);
		}else if(where == SHARE_MEDIA.SINA){
//			Log.e("SNSController", "loza-sendText");
//			mWeiBoController = WeiBoController.getInstance(activity);
//			mWeiBoController.init(activity.getIntent());
//			Log.e("SNSController", "loza-sendText2");
//			mWeiBoController.sendTextMessage(title, 
//					content, 
//					pic_path,
//					pic_url,
//					webUrl,
//					thumb,
//					lsn);
		}else if(where == SHARE_MEDIA.SMS){
			SMSController.getInstance(mContext, mActivity).sendMessage(content);
		}
	}
}
